package com.uenpay.im.ui.old.activity.dynamic;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONObject;

import com.qyx.android.entity.FriendEntity;

public class FriendSerializer {
	public static FriendEntity DeserializeFriend(JSONObject json) {
		FriendEntity friend = new FriendEntity();
		friend.cust_id = json.optString("custid");
		friend.nick_name = json.optString("nickname");
		return friend;
	}

	public static ArrayList<FriendEntity> DeserializeFriends(JSONArray json) {
		ArrayList<FriendEntity> friends = new ArrayList<FriendEntity>();
		for (int i = 0; i < json.length(); i++) {
			friends.add(DeserializeFriend(json.optJSONObject(i)));
		}
		return friends;
	}
}